/*
 * SimpleLocker.h
 *
 *  Created on: Jun 16, 2014
 *      Author: brightchen
 */

#ifndef SIMPLELOCKER_H_
#define SIMPLELOCKER_H_

namespace std
{
  class SimpleLocker
  {
  private:
    pthread_mutex_t locker;

    inline SimpleLocker(){}

  public:
    inline SimpleLocker( pthread_mutex_t locker )
    {
      this->locker = locker;
      pthread_mutex_lock( &locker );
    }

    inline ~SimpleLocker()
    {
      pthread_mutex_unlock( &locker );
    }
  };

} /* namespace std */

#endif /* SIMPLELOCKER_H_ */
